package lab02.test03;
//学生类输出学生信息
public class Student {
    //属性
    private float computerGradle;
    private float mathGradle;
    private float englishlGradle;

    public Student() {
    }

    public Student(float computerGradle, float mathGradle, float englishGradle) {
        this.computerGradle = computerGradle;
        this.mathGradle = mathGradle;
        this.englishlGradle = englishGradle;
    }

    public float getComputerGradle() {
        return computerGradle;
    }

    public void setComputerGradle(float computerGradle) {
        this.computerGradle = computerGradle;
    }

    public float getMathGradle() {
        return mathGradle;
    }

    public void setMathGradle(float mathGradle) {
        this.mathGradle = mathGradle;
    }

    public float getEnglishGradle() {
        return englishlGradle;
    }

    public void setEnglishGradle(float englishGradle) {
        this.englishlGradle = englishGradle;
    }
    public void sum(){
        float sum = computerGradle + mathGradle + englishlGradle;
        System.out.println("该学生的总分为：" + sum);
    }
    public void average(){
        float average = (computerGradle + mathGradle + englishlGradle)/3;
        System.out.println("该学生的平均成绩为：" + average);
    }
    public void max(){
        float max = computerGradle;
        if (max < mathGradle){
            max = mathGradle;
            if (max < englishlGradle){
                max = englishlGradle;
            }
        }else if (max < englishlGradle){
            max = englishlGradle;
        }
        System.out.println("该学生的最高分为:" + max);
    }
    public void min(){
        float min = computerGradle;
        if (min > mathGradle){
            min = mathGradle;
            if (min > englishlGradle){
                min = englishlGradle;
            }
        }else if (min > englishlGradle){
            min = englishlGradle;
        }
        System.out.println("该学生的最低分为:" + min);
    }

    @Override
    public String toString() {
        return "该学生的信息：" + "\n"+ "计算机：" + computerGradle + "\n" +
                "数学："+ mathGradle + "\n" + "英语：" + englishlGradle;
    }
}
